package com.zbkj.crmeb.store.service.impl;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zbkj.crmeb.store.dao.TemplatesCostConfigDao;
import com.zbkj.crmeb.store.model.TemplatesCostConfig;
import com.zbkj.crmeb.store.request.TemplatesCostConfigRequest;
import com.zbkj.crmeb.store.service.TemplatesCostConfigService;

/**
* @author Mr.Zhang
* @Description TemplatesCostConfigServiceImpl 接口实现
* @since 2020-05-28
*/
@Service
public class TemplatesCostConfigServiceImpl extends ServiceImpl<TemplatesCostConfigDao, TemplatesCostConfig> implements TemplatesCostConfigService {

    private static Logger logger = LoggerFactory.getLogger(TemplatesCostConfigServiceImpl.class);

    @Resource
    private  TemplatesCostConfigDao dao;

    @Override
    public TemplatesCostConfig selectTemplatesCostConfigOne(TemplatesCostConfigRequest request) {
        LambdaQueryWrapper<TemplatesCostConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(TemplatesCostConfig::getCategoryId, request.getCategoryId());
        lambdaQueryWrapper.eq(TemplatesCostConfig::getFromTempId, request.getFromTempId());
        lambdaQueryWrapper.eq(TemplatesCostConfig::getToTempId, request.getToTempId());
        lambdaQueryWrapper.last("LIMIT 1");
        return dao.selectOne(lambdaQueryWrapper);
    }
}


